

<!DOCTYPE html>
<html lang="zh-CN" data-default-color-scheme=&#34;light&#34;>



<head>
  <meta charset="UTF-8">
  <link rel="apple-touch-icon" sizes="76x76" href="/img/me/title.jpg">
  <link rel="icon" type="image/png" href="/img/me/title.jpg">
  <meta name="viewport"
        content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  
  <meta name="theme-color" content="#2f4154">
  <meta name="description" content="你要悄悄学web，然后惊艳所有人">
  <meta name="author" content="yxfan">
  <meta name="keywords" content="">
  <title>vue中的组件通信 - yxfan</title>

  <link  rel="stylesheet" href="https://fastly.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css" />


  <link  rel="stylesheet" href="https://fastly.jsdelivr.net/npm/github-markdown-css@4.0.0/github-markdown.min.css" />
  <link  rel="stylesheet" href="/lib/hint/hint.min.css" />

  
    
    
      
      <link  rel="stylesheet" href="https://fastly.jsdelivr.net/npm/highlight.js@10.4.0/styles/github-gist.min.css" />
    
  

  
    <link  rel="stylesheet" href="https://fastly.jsdelivr.net/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css" />
  



<!-- 主题依赖的图标库，不要自行修改 -->

<link rel="stylesheet" href="//at.alicdn.com/t/font_1749284_ba1fz6golrf.css">



<link rel="stylesheet" href="//at.alicdn.com/t/font_1736178_kmeydafke9r.css">


<link  rel="stylesheet" href="/css/main.css" />

<!-- 自定义样式保持在最底部 -->


  <script id="fluid-configs">
    var Fluid = window.Fluid || {};
    var CONFIG = {"hostname":"yoursite.com","root":"/","version":"1.8.7","typing":{"enable":true,"typeSpeed":70,"cursorChar":"_","loop":false},"anchorjs":{"enable":true,"element":"h1,h2,h3","placement":"right","visible":"always","Option":"§ |","icon":"#"},"progressbar":{"enable":true,"height_px":3,"color":"#29d","options":{"showSpinner":false,"trickleSpeed":100}},"copy_btn":true,"image_zoom":{"enable":true},"toc":{"enable":true,"headingSelector":"h1,h2,h3,h4,h5,h6","collapseDepth":20},"lazyload":{"enable":true,"onlypost":false},"web_analytics":{"enable":true,"baidu":null,"google":null,"gtag":null,"tencent":{"sid":null,"cid":null},"woyaola":null,"cnzz":null,"leancloud":{"app_id":"AGrJP3tUCktoWpoiRigqj3zy-gzGzoHsz","app_key":"r0u61FlVNs3yvXwGYocWG3qm","server_url":null}}};
  </script>
  <script  src="/js/utils.js" ></script>
  <script  src="/js/color-schema.js" ></script>
<meta name="generator" content="Hexo 5.4.0"></head>


<body>
  <header style="height: 70vh;">
    <nav id="navbar" class="navbar fixed-top  navbar-expand-lg navbar-dark scrolling-navbar">
  <div class="container">
    <a class="navbar-brand"
       href="/">&nbsp;<strong>yxfan</strong>&nbsp;</a>

    <button id="navbar-toggler-btn" class="navbar-toggler" type="button" data-toggle="collapse"
            data-target="#navbarSupportedContent"
            aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <div class="animated-icon"><span></span><span></span><span></span></div>
    </button>

    <!-- Collapsible content -->
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav ml-auto text-center">
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/">
                <i class="iconfont icon-home-fill"></i>
                首页
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/archives/">
                <i class="iconfont icon-archive-fill"></i>
                归档
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/tags/">
                <i class="iconfont icon-tags-fill"></i>
                标签
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/about/">
                <i class="iconfont icon-user-fill"></i>
                关于
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/links/">
                <i class="iconfont icon-link-fill"></i>
                友链
              </a>
            </li>
          
        
        
          <li class="nav-item" id="search-btn">
            <a class="nav-link" data-toggle="modal" data-target="#modalSearch">&nbsp;<i
                class="iconfont icon-search"></i>&nbsp;</a>
          </li>
        
        
          <li class="nav-item" id="color-toggle-btn">
            <a class="nav-link" href="javascript:">&nbsp;<i
                class="iconfont icon-dark" id="color-toggle-icon"></i>&nbsp;</a>
          </li>
        
      </ul>
    </div>
  </div>
</nav>

    <div class="banner" id="banner" parallax=true
         style="background: url('/img/background/lu_bule.png') no-repeat center center;
           background-size: cover;">
      <div class="full-bg-img">
        <div class="mask flex-center" style="background-color: rgba(0, 0, 0, 0.3)">
          <div class="page-header text-center fade-in-up">
            <span class="h2" id="subtitle" title="vue中的组件通信">
              
            </span>

            
              <div class="mt-3">
  
  
    <span class="post-meta">
      <i class="iconfont icon-date-fill" aria-hidden="true"></i>
      <time datetime="2019-12-01 21:49" pubdate>
        2019年12月1日 晚上
      </time>
    </span>
  
</div>

<div class="mt-1">
  
    
    <span class="post-meta mr-2">
      <i class="iconfont icon-chart"></i>
      977 字
    </span>
  

  
    
    <span class="post-meta mr-2">
      <i class="iconfont icon-clock-fill"></i>
      
      
      14
       分钟
    </span>
  

  
  
    
      <!-- 不蒜子统计文章PV -->
      <span id="busuanzi_container_page_pv" style="display: none">
        <i class="iconfont icon-eye" aria-hidden="true"></i>
        <span id="busuanzi_value_page_pv"></span> 次
      </span>
    
  
</div>

            
          </div>

          
        </div>
      </div>
    </div>
  </header>

  <main>
    
      

<div class="container-fluid nopadding-x">
  <div class="row nomargin-x">
    <div class="d-none d-lg-block col-lg-2"></div>
    <div class="col-lg-8 nopadding-x-md">
      <div class="container nopadding-x-md" id="board-ctn">
        <div class="py-5" id="board">
          <article class="post-content mx-auto">
            <!-- SEO header -->
            <h1 style="display: none">vue中的组件通信</h1>
            
            <div class="markdown-body">
              <p>vue中的组件通信无论是在做项目，还是笔试面试时都很重要</p>
<p>下面我们来说一说vue组件通信的三种情况</p>
<h3 id="父-gt-子"><a href="#父-gt-子" class="headerlink" title="父-&gt;子"></a>父-&gt;子</h3><p>父子组件通信是利用自定义属性传值，该情形分为两步：</p>
<ul>
<li>1.在父组件中，将子组件需要的成员绑定给一个自定义的属性。</li>
<li>2.在子组件中，通过props获得父组件放在子组件中的自定义属性值。</li>
</ul>
<div class="code-wrapper"><pre><code class="hljs javascript"><span class="hljs-comment">//父组件</span>
Vue.component(<span class="hljs-string">&#x27;todo&#x27;</span>,&#123;
    <span class="hljs-attr">template</span>:<span class="hljs-string">`</span>
<span class="hljs-string">        &lt;div&gt;</span>
<span class="hljs-string">            &lt;h1&gt;代办任务列表&lt;/h1&gt;</span>
<span class="hljs-string">            &lt;todo-add&gt;&lt;/todo-add&gt;</span>
<span class="hljs-string">            &lt;todo-list :msg=&#x27;tasks&#x27;&gt;&lt;/todo-list&gt;</span>
<span class="hljs-string">        &lt;/div&gt;</span>
<span class="hljs-string">    `</span>,
    <span class="hljs-function"><span class="hljs-title">data</span>(<span class="hljs-params"></span>)</span>&#123;
        <span class="hljs-keyword">return</span> &#123;
            <span class="hljs-attr">tasks</span>:[<span class="hljs-string">&quot;吃饭&quot;</span>,<span class="hljs-string">&quot;睡觉&quot;</span>,<span class="hljs-string">&quot;打亮亮&quot;</span>]
        &#125;
    &#125;,
    <span class="hljs-attr">components</span>:&#123;
        todoAdd,
        todoList
    &#125;
&#125;)</code></pre></div>
<div class="code-wrapper"><pre><code class="hljs javascript"><span class="hljs-comment">//子组件</span>
<span class="hljs-keyword">var</span> todoList=&#123;
    <span class="hljs-attr">template</span>:<span class="hljs-string">`</span>
<span class="hljs-string">        &lt;ul &gt;</span>
<span class="hljs-string">            &lt;todo-item v-for=&#x27;(t,i) of tasks&#x27; :key=&#x27;t&#x27; :t=&quot;t&quot; :i=&quot;i&quot;</span>
<span class="hljs-string">            :tasks=&quot;tasks&quot;&gt;</span>
<span class="hljs-string">            &lt;/todo-item&gt;</span>
<span class="hljs-string">        &lt;/ul&gt;</span>
<span class="hljs-string">    `</span>,
    <span class="hljs-attr">props</span>:[<span class="hljs-string">&#x27;msg&#x27;</span>],
    <span class="hljs-attr">components</span>:&#123;
        todoItem
    &#125;
&#125;</code></pre></div>
<h3 id="子-gt-父"><a href="#子-gt-父" class="headerlink" title="子-&gt;父"></a>子-&gt;父</h3><p>子-&gt;父是自定义事件传值，分飞两步：</p>
<ul>
<li>1.在父组件中，自定义一个事件，并绑定好事件处理函数</li>
<li>2.在子组件中，在自己的事件处理函数中通过$emit触发父组件的自定义事件，并传参</li>
</ul>
<div class="code-wrapper"><pre><code class="hljs html"><span class="hljs-comment">&lt;!--父组件--&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">template</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span>&#123;&#123;fa&#125;&#125;<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">sun</span> @<span class="hljs-attr">show</span>=<span class="hljs-string">&quot;showon&quot;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">sun</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">template</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">script</span>&gt;</span><span class="javascript"></span>
<span class="javascript"><span class="hljs-keyword">import</span> sun <span class="hljs-keyword">from</span> <span class="hljs-string">&quot;./child.vue&quot;</span></span>
<span class="javascript"><span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> &#123;</span>
<span class="javascript">    <span class="hljs-function"><span class="hljs-title">data</span>(<span class="hljs-params"></span>)</span>&#123;</span>
<span class="javascript">        <span class="hljs-keyword">return</span>&#123;</span>
<span class="javascript">            <span class="hljs-attr">fa</span>:<span class="hljs-string">&quot;这是父组件的值&quot;</span></span>
<span class="javascript">        &#125;</span>
<span class="javascript">    &#125;,</span>
<span class="javascript">    <span class="hljs-attr">methods</span>:&#123;</span>
<span class="javascript">        <span class="hljs-function"><span class="hljs-title">showon</span>(<span class="hljs-params">data</span>)</span>&#123;</span>
<span class="javascript">            <span class="hljs-built_in">this</span>.fa=data</span>
<span class="javascript">        &#125;</span>
<span class="javascript">    &#125;,</span>
<span class="javascript">    <span class="hljs-attr">components</span>:&#123;</span>
<span class="javascript">        sun</span>
<span class="javascript">    &#125;</span>
<span class="javascript">&#125;</span>
<span class="javascript"></span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span></code></pre></div>
<div class="code-wrapper"><pre><code class="hljs html"><span class="hljs-comment">&lt;!--子组件--&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">template</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span>
       <span class="hljs-tag">&lt;<span class="hljs-name">button</span> @<span class="hljs-attr">click</span>=<span class="hljs-string">&quot;change&quot;</span>&gt;</span>传递<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">template</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">script</span>&gt;</span><span class="javascript"></span>
<span class="javascript"><span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> &#123;</span>
<span class="javascript">    <span class="hljs-attr">methods</span>:&#123;</span>
<span class="javascript">        <span class="hljs-function"><span class="hljs-title">change</span>(<span class="hljs-params"></span>)</span>&#123;</span>
<span class="javascript">            <span class="hljs-built_in">this</span>.$emit(<span class="hljs-string">&quot;show&quot;</span>,<span class="hljs-string">&quot;这是子组件的内容&quot;</span>)</span>
<span class="javascript">        &#125;</span>
<span class="javascript">    &#125;</span>
<span class="javascript">&#125;</span>
<span class="javascript"></span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span></code></pre></div>
<h3 id="兄弟之间传值"><a href="#兄弟之间传值" class="headerlink" title="兄弟之间传值"></a>兄弟之间传值</h3><p>该情况有点特殊，分为三步：</p>
<ul>
<li>1.在脚手架中创建一个公共的new Vue实例；用来保存事件，并关联到任何一个组件的处理函数上</li>
<li>2.数据的接受方组件，在自己加载完成后，向公共实例上添加一个自定义的事件，事件要绑定上自己的一个处理函数</li>
<li>3.发送方要在自己的事件处理函数中，找到公共实例对象，用$emit()触发别人提前在bus上绑定好的事件，并传参</li>
</ul>
<p>1.单独创建一个bus.js</p>
<div class="code-wrapper"><pre><code class="hljs javascript"><span class="hljs-keyword">import</span> Vue <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;vue&#x27;</span>
<span class="hljs-comment">//一个公共的new Vue实例</span>
<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-keyword">new</span> Vue();</code></pre></div>
<p>2.main.js中</p>
<div class="code-wrapper"><pre><code class="hljs javascript"><span class="hljs-keyword">import</span> bus <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;./bus&#x27;</span>
<span class="hljs-comment">//放在原型对象上，任何一个组件都可以访问</span>
Vue.prototype.bus=bus;
Vue.config.productionTip = <span class="hljs-literal">false</span>
<span class="hljs-keyword">new</span> Vue(&#123;
  router,
  store,
  <span class="hljs-attr">render</span>: <span class="hljs-function"><span class="hljs-params">h</span> =&gt;</span> h(App)
&#125;).$mount(<span class="hljs-string">&#x27;#app&#x27;</span>)</code></pre></div>
<p>3.数据的接受方,用$on向公共实例上添加一个自定义事件，并绑上自己的处理函数</p>
<div class="code-wrapper"><pre><code class="hljs html"><span class="hljs-tag">&lt;<span class="hljs-name">template</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">ul</span> <span class="hljs-attr">class</span>=<span class="hljs-string">&quot;todo-list&quot;</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">todo-item</span> <span class="hljs-attr">v-for</span>=<span class="hljs-string">&quot;(task,i) of tasks&quot;</span> <span class="hljs-attr">:key</span>=<span class="hljs-string">&quot;i&quot;</span> <span class="hljs-attr">:i</span>=<span class="hljs-string">&quot;i&quot;</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">template</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">&quot;task&quot;</span>&gt;</span>&#123;&#123;task&#125;&#125;<span class="hljs-tag">&lt;/<span class="hljs-name">template</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">todo-item</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">ul</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">template</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">script</span>&gt;</span><span class="javascript"></span>
<span class="javascript"><span class="hljs-keyword">import</span> todoItem <span class="hljs-keyword">from</span> <span class="hljs-string">&quot;./TodoItem&quot;</span></span>
<span class="javascript"><span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> &#123;</span>
<span class="javascript">  <span class="hljs-function"><span class="hljs-title">data</span>(<span class="hljs-params"></span>)</span>&#123;</span>
<span class="javascript">    <span class="hljs-keyword">return</span> &#123;</span>
<span class="javascript">      <span class="hljs-attr">tasks</span>:[<span class="hljs-string">&#x27;吃饭&#x27;</span>,<span class="hljs-string">&#x27;睡觉&#x27;</span>,<span class="hljs-string">&quot;打亮亮&quot;</span>]</span>
<span class="javascript">    &#125;</span>
<span class="javascript">  &#125;,</span>
<span class="javascript">  <span class="hljs-function"><span class="hljs-title">created</span>(<span class="hljs-params"></span>)</span>&#123;</span>
<span class="javascript">    <span class="hljs-comment">//回调中的函数this指window，所以必须用bind永久绑定当前组件</span></span>
<span class="javascript">    <span class="hljs-built_in">this</span>.bus.$on(<span class="hljs-string">&quot;add_task&quot;</span>,<span class="hljs-built_in">this</span>.add.bind(<span class="hljs-built_in">this</span>))</span>
<span class="javascript">  &#125;,</span>
<span class="javascript">  <span class="hljs-attr">methods</span>:&#123;</span>
<span class="javascript">    <span class="hljs-function"><span class="hljs-title">add</span>(<span class="hljs-params">task</span>)</span>&#123;</span>
<span class="javascript">      <span class="hljs-built_in">this</span>.tasks.push(task);</span>
<span class="javascript">    &#125;</span>
<span class="javascript">  &#125;,</span>
<span class="javascript">  <span class="hljs-attr">components</span>:&#123;</span>
<span class="javascript">    todoItem</span>
<span class="javascript">  &#125;</span>
<span class="javascript">&#125;</span>
<span class="javascript"></span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span></code></pre></div>
<p>4.数据的发送方,用$emit触发别人在公共实例上绑定好的事件，并传参</p>
<div class="code-wrapper"><pre><code class="hljs html"><span class="hljs-tag">&lt;<span class="hljs-name">template</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">&quot;todo-add&quot;</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">&quot;text&quot;</span> <span class="hljs-attr">v-model</span>=<span class="hljs-string">&quot;task&quot;</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">button</span> @<span class="hljs-attr">click</span>=<span class="hljs-string">&quot;add&quot;</span>&gt;</span>+<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">template</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">script</span>&gt;</span><span class="javascript"></span>
<span class="javascript"><span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> &#123;</span>
<span class="javascript">  <span class="hljs-function"><span class="hljs-title">data</span>(<span class="hljs-params"></span>)</span>&#123;</span>
<span class="javascript">    <span class="hljs-keyword">return</span> &#123;</span>
<span class="javascript">      <span class="hljs-attr">task</span>:<span class="hljs-string">&quot;&quot;</span></span>
<span class="javascript">    &#125;</span>
<span class="javascript">  &#125;,</span>
<span class="javascript">  <span class="hljs-attr">methods</span>:&#123;</span>
<span class="javascript">    <span class="hljs-function"><span class="hljs-title">add</span>(<span class="hljs-params"></span>)</span>&#123;</span>
<span class="javascript">      <span class="hljs-built_in">this</span>.bus.$emit(<span class="hljs-string">&quot;add_task&quot;</span>,<span class="hljs-built_in">this</span>.task);</span>
<span class="javascript">      <span class="hljs-built_in">this</span>.task=<span class="hljs-string">&quot;&quot;</span>;</span>
<span class="javascript">    &#125;</span>
<span class="javascript">  &#125;</span>
<span class="javascript">&#125;</span>
<span class="javascript"></span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span></code></pre></div>
            </div>
            <hr>
            <div>
              <div class="post-metas mb-3">
                
                
                  <div class="post-meta">
                    <i class="iconfont icon-tags"></i>
                    
                      <a class="hover-with-bg" href="/tags/vue/">vue</a>
                    
                  </div>
                
              </div>
              
                <p class="note note-warning">转载请注明出处！</p>
              
              
                <div class="post-prevnext">
                  <article class="post-prev col-6">
                    
                    
                      <a href="/2019/12/17/%E4%BD%BF%E7%94%A8js%E5%AE%9E%E7%8E%B0MQTT/">
                        <i class="iconfont icon-arrowleft"></i>
                        <span class="hidden-mobile">使用js实现MQTT</span>
                        <span class="visible-mobile">上一篇</span>
                      </a>
                    
                  </article>
                  <article class="post-next col-6">
                    
                    
                      <a href="/2019/11/27/React%E4%B8%AD%E7%9A%84%E5%8F%8C%E5%90%91%E6%95%B0%E6%8D%AE%E7%BB%91%E5%AE%9A/">
                        <span class="hidden-mobile">React中的数据绑定</span>
                        <span class="visible-mobile">下一篇</span>
                        <i class="iconfont icon-arrowright"></i>
                      </a>
                    
                  </article>
                </div>
              
            </div>

            
          </article>
        </div>
      </div>
    </div>
    
      <div class="d-none d-lg-block col-lg-2 toc-container" id="toc-ctn">
        <div id="toc">
  <p class="toc-header"><i class="iconfont icon-list"></i>&nbsp;目录</p>
  <div class="toc-body" id="toc-body"></div>
</div>

      </div>
    
  </div>
</div>

<!-- Custom -->


    

    
      <a id="scroll-top-button" href="#" role="button">
        <i class="iconfont icon-arrowup" aria-hidden="true"></i>
      </a>
    

    
      <div class="modal fade" id="modalSearch" tabindex="-1" role="dialog" aria-labelledby="ModalLabel"
     aria-hidden="true">
  <div class="modal-dialog modal-dialog-scrollable modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header text-center">
        <h4 class="modal-title w-100 font-weight-bold">搜索</h4>
        <button type="button" id="local-search-close" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body mx-3">
        <div class="md-form mb-5">
          <input type="text" id="local-search-input" class="form-control validate">
          <label data-error="x" data-success="v"
                 for="local-search-input">关键词</label>
        </div>
        <div class="list-group" id="local-search-result"></div>
      </div>
    </div>
  </div>
</div>
    

    
  </main>

  <footer class="text-center mt-5 py-3">
  <div class="footer-content">
    
  </div>
  

  

  
</footer>

<!-- SCRIPTS -->

  <script  src="https://fastly.jsdelivr.net/npm/nprogress@0.2.0/nprogress.min.js" ></script>
  <link  rel="stylesheet" href="https://fastly.jsdelivr.net/npm/nprogress@0.2.0/nprogress.min.css" />

  <script>
    NProgress.configure({"showSpinner":false,"trickleSpeed":100})
    NProgress.start()
    window.addEventListener('load', function() {
      NProgress.done();
    })
  </script>


<script  src="https://fastly.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js" ></script>
<script  src="https://fastly.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.min.js" ></script>
<script  src="/js/debouncer.js" ></script>
<script  src="/js/events.js" ></script>
<script  src="/js/plugins.js" ></script>

<!-- Plugins -->


  
    <script  src="/js/lazyload.js" ></script>
  



  



  <script  src="https://fastly.jsdelivr.net/npm/tocbot@4.12.0/dist/tocbot.min.js" ></script>



  <script  src="https://fastly.jsdelivr.net/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.js" ></script>



  <script  src="https://fastly.jsdelivr.net/npm/anchor-js@4.3.0/anchor.min.js" ></script>



  <script defer src="https://fastly.jsdelivr.net/npm/clipboard@2.0.6/dist/clipboard.min.js" ></script>



  <script defer src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js" ></script>


  <script defer src="/js/leancloud.js" ></script>



  <script  src="https://fastly.jsdelivr.net/npm/typed.js@2.0.11/lib/typed.min.js" ></script>
  <script>
    (function (window, document) {
      var typing = Fluid.plugins.typing;
      var title = document.getElementById('subtitle').title;
      
      typing(title)
      
    })(window, document);
  </script>



  <script  src="/js/local-search.js" ></script>
  <script>
    (function () {
      var path = "/local-search.xml";
      var inputArea = document.querySelector("#local-search-input");
      inputArea.onclick = function () {
        searchFunc(path, 'local-search-input', 'local-search-result');
        this.onclick = null
      }
    })()
  </script>












  

  

  

  

  

  





<!-- 主题的启动项 保持在最底部 -->
<script  src="/js/boot.js" ></script>



</body>
</html>
